<template>
	<el-drawer title="楼宇档案" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="楼宇名称" prop="name">{{form.name}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="所属园区" prop="park_id">{{form.park_id}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="楼宇总层数" prop="total_number_pricing">{{form.total_number_pricing}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="房间数量" prop="room_number">{{form.room_number}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="功能类别" prop="function_type">{{form.function_type}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="空间介绍" prop="space_intro">{{form.space_intro}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="产业定位" prop="industry_positioning">{{form.industry_positioning}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="招商政策" prop="investment_policy">{{form.investment_policy}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="是否推荐" prop="recommended">{{form.recommended}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="空间图片上传" prop="spatial_pictures">{{form.spatial_pictures}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="附件上传" prop="attach_upload">{{form.attach_upload}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<!-- <el-form-item label="附件上传" prop="attachment_upload">{{form.attachment_upload}}</el-form-item> -->
						</el-col>
					</el-row>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
import AttachMenu from '@/views/module/attachMenu'
export default {
	emits: ['success', 'closed'],
	components: {
		AttachMenu
	},
	data() {
		return {
			loading: false,
			form: {
				id:'',
				name:'',
				park_id:'',
				total_number_pricing:'',
				room_number:""
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(){
			this.visible = true;
			return this;
		},
		async setData(data){
			let res = await this.$API.attractinvestment.building.getBuildingById.get({id:data.id});
			let resPark = await this.$API.attractinvestment.park.getParkById.get({id:res.data[0].park_id});
			this.form.id = res.data[0].id
			this.form.name = res.data[0].name
			this.form.park_id = resPark.data[0].name
			this.form.total_number_pricing = res.data[0].total_number_pricing
			this.form.room_number = res.data[0].room_number
			this.form.function_type = res.data[0].function_type
			this.form.space_intro = res.data[0].space_intro
			this.form.industry_positioning = res.data[0].industry_positioning
			this.form.investment_policy = res.data[0].investment_policy
			this.form.recommended = res.data[0].recommended
			this.form.spatial_pictures = res.data[0].spatial_pictures
			this.form.attach_upload = res.data[0].attach_upload
			// this.form.id = data.id
			// this.form.name = data.name
			// this.form.park_id = res.data.length==0 ? '未选择' : res.data[0].name
			// this.form.total_number_pricing = data.total_number_pricing
			// this.form.room_number = data.room_number
		},
		async getBuildingById(data)
		{
			let res = await this.$API.attractinvestment.building.getBuildingById.get({id:data});
			{
				if(res.code==200)
				{
					this.form.id = res.data.id
					this.form.name = res.data.name
					this.form.park_id = res.data.park_id
					this.form.total_number_pricing = res.data.total_number_pricing
					this.form.room_number = res.data.room_number
				}else
				{
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}
		}
	}
}
</script>

<style>
</style>
